package editAir.buildEdit
{
	import _Pan3D.role.MeshDataManager;
	import _Pan3D.texture.TextureManager;
	
	import _me.Config;
	import _me.Scene_data;
	
	import flash.display.MovieClip;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.display3D.Context3D;
	import flash.events.Event;
	
	import newPan3d.content.scene.PanSceneLevel;
	import newPan3d.ui.UiView;
	
	// --------------MSN:lation_pan@live.cn  QQ: 3423526------------- //
	[SWF(backgroundColor="#FFFFFF", frameRate="60", width="1024", height="600")]
	public class indexEditBuild extends MovieClip
	{
		
		private var _uiView:UiView;
		private var _sceneView:EditSceneLevel;
		
		public function indexEditBuild()
		{
			this.addEventListener(Event.ADDED_TO_STAGE, addToStage)
		}
		
		private function addToStage(evt:Event):void
		{
			
			
			Scene_data.stage=this.stage;
			Scene_data.root=this;
			
			Scene_data.fileRoot="http://pan3dme.lt6.nns.cc/pan3D/yizhan/_File/nijia2/";
			Scene_data.fileRoot="../_File/beijing1/";
			_uiView=new UiView;
			addChild(_uiView);
			
			Config.init(stage, _config_end);
			
			
		}
		private function _config_end():void
		{
			var context3D:Context3D=Scene_data.context3D;
			TextureManager.getInstance().init(context3D);
			MeshDataManager.getInstance().init(context3D);
			
			_sceneView=new EditSceneLevel;
			_sceneView.initData();
			Scene_data.stage.addEventListener(Event.ENTER_FRAME,onEnterFrame);
			Scene_data.stage.addEventListener(Event.RESIZE,stageResize)
			
			stage.scaleMode=StageScaleMode.NO_SCALE
			stage.align=StageAlign.TOP_LEFT;
			stageResize(new Event(Event.RESIZE))
			

		}
		
		protected function stageResize(event:Event):void
		{
			
			Scene_data.stageWidth=stage.stageWidth;
			Scene_data.stageHeight=stage.stageHeight;
			_sceneView.stageResize();
			
			
		}
		private function onEnterFrame(event:Event):void
		{
			_sceneView.upData();

			
		}
		
		public function get uiView():UiView
		{
			return _uiView;
		}
		
		
	}
}